<?php

 
 Zend_Loader::loadClass("BaseDBRows");
 Zend_Loader::loadClass("Address");
 class Addresses extends BaseDBRows
 {
 	protected function setUp()
 	{
 		$this->_tableName = Address::_tablename;
 	}	
	
	public function getCountries($fields=array()){
		Zend_Loader::loadClass("QueryCreator");
		
		$query = new QueryCreator();
		if(count($fields)) {
			foreach($fields as $key => $value) {
				$query->addSelect($value);
			}
		} else {
			$query->addSelect(" * ");
		}
		$query->addFrom($this->_tableName );
		$query->addOrderBy(" country ");
		
		$db = DBCon::instance();
		$result = $db->executeQuery($query->createSQL());
		return $result;
		
	}
	
	public function getAddress($addressId) {
	
		Zend_Loader::loadClass("QueryCreator");
		
		$query = new QueryCreator();
		$query->addSelect(" * ");
		$query->addFrom($this->_tableName . " a ");
		$query->addWhere("address_id = " . $addressId);
			
		$db = DBCon::instance();
		// echo  $query->createSQL();die();
		$result = $db->executeQuery($query->createSQL());
		return $result;
		
	}
	
	
	
 }
?>